package com.hs.srm.admin.modules.quota.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hs.srm.admin.modules.quota.dao.QuotaHistoryDao;
import com.hs.srm.admin.modules.quota.entity.QuotaHistoryEntity;
import com.hs.srm.admin.modules.quota.service.QuotaHistoryService;
import com.hs.srm.base.common.utils.QueryParam;
import com.hs.srm.common.utils.PageUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;


/**
 *
 * @author Sunnykid
 * @date 2019年3月17日
 */
@Service("quotaHistoryService")
public class QuotaServiceHistoryImpl extends ServiceImpl<QuotaHistoryDao, QuotaHistoryEntity> implements QuotaHistoryService {

    /**
     * 分页查询
     */
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String vendorCode = (String) params.get("vendorCode");
        String materialCode = (String) params.get("materialCode");
        String werks = (String) params.get("werks");
        Page<QuotaHistoryEntity> page = this.selectPage(
                new QueryParam<QuotaHistoryEntity>(params).getPage(),
                new EntityWrapper<QuotaHistoryEntity>()
                        .eq(StringUtils.isNotBlank(vendorCode), "vendor_code", vendorCode)
                        .eq(StringUtils.isNotBlank(materialCode), "material_code", materialCode)
                        .eq(StringUtils.isNotBlank(werks), "werks", werks));

        return new PageUtils(page);
    }

}
